home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / m_emacs / dif311a / input.dif < prev    next >
Encoding:
Text File  |  1991-11-22  |  3.8 KB  |  149 lines

  1. 299,327d298
  2. <             goto clist;
  3. <         } else if (c == '?') {    
  4. < clist:            /* make a completion list! */
  5. <             switch (type) {
  6. <                 case CMP_BUFFER:
  7. <                     clist_buffer(buf, &cpos);
  8. <                     break;
  9. <                 case CMP_COMMAND:
  10. <                     clist_command(buf, &cpos);
  11. <                     break;
  12. <                 case CMP_FILENAME:
  13. <                     clist_file(buf, &cpos);
  14. <                     break;
  15. <             }
  16. <             update(TRUE);
  17. <             /* if it exists, reprompt the user */
  18. <             if (prompt) {
  19. <                 buf[cpos] = 0;
  20. <                 if (type == CMP_COMMAND)
  21. <                     mlwrite("%s%s", prompt, buf);
  22. <                 else if (defval)
  23. <                     mlwrite("%s[%s]: %s", prompt, defval, buf);
  24. <                 else
  25. <                     mlwrite("%s: %s", prompt, buf);
  26. <             }
  27. 415,450d385
  28. < /*    clist_command:    Make a completion list based on a partial name */
  29. < clist_command(name, cpos)
  30. < char *name;    /* command containing the current name to complete */
  31. < int *cpos;    /* ptr to position of next character to insert */
  32. < {
  33. <     register NBIND *bp;    /* trial command to complete */
  34. <     register int curbind;    /* index into the names[] array */
  35. <     register int name_len;    /* current length of input string */
  36. <     register BUFFER *listbuf;/* buffer to put completion list into */
  37. <     /* get a buffer for the completion list */
  38. <     listbuf = bfind("[Completion list]", TRUE, BFINVS);
  39. <     if (listbuf == NULL || bclear(listbuf) == FALSE) {
  40. <         ctrlg(FALSE, 0);
  41. <         TTflush();
  42. <         return;
  43. <     }
  44. <     name_len = *cpos;
  45. <     /* first, we start at the first command and scan the list */
  46. <     for (curbind = 0; curbind <= numfunc; curbind++) {
  47. <         /* is this a match? */
  48. <         bp = &names[curbind];
  49. <         if (strncmp(name, bp->n_name, name_len) == 0)
  50. <             addline(listbuf, bp->n_name);
  51. <     }
  52. <     wpopup(listbuf);
  53. <     return;
  54. < }
  55. 524,561d458
  56. < /*    clist_buffer:    Make a completion list based on a partial buffer name */
  57. < clist_buffer(name, cpos)
  58. < char *name;    /* command containing the current name to complete */
  59. < int *cpos;    /* ptr to position of next character to insert */
  60. < {
  61. <     register int name_len;    /* current length of input string */
  62. <     register BUFFER *listbuf;/* buffer to put completion list into */
  63. <     register BUFFER *bp;    /* trial buffer to complete */
  64. <     /* get a buffer for the completion list */
  65. <     listbuf = bfind("[Completion list]", TRUE, BFINVS);
  66. <     if (listbuf == NULL || bclear(listbuf) == FALSE) {
  67. <         ctrlg(FALSE, 0);
  68. <         TTflush();
  69. <         return;
  70. <     }
  71. <     /* first, we start at the first buffer and scan the list */
  72. <     name_len = *cpos;
  73. <     bp = bheadp;
  74. <     while (bp) {
  75. <         /* is this a match? */
  76. <         if (strncmp(name, bp->b_bname, name_len) == 0)
  77. <             addline(listbuf, bp->b_bname);
  78. <         /* on to the next buffer */
  79. <         bp = bp->b_bufp;
  80. <     }
  81. <     wpopup(listbuf);
  82. <     return;
  83. < }
  84. 637,677d533
  85. <     return;
  86. < }
  87. < /*    clist_file:    Make a completion list based on a partial file name */
  88. < clist_file(name, cpos)
  89. < char *name;    /* command containing the current name to complete */
  90. < int *cpos;    /* ptr to position of next character to insert */
  91. < {
  92. <     register int name_len;    /* current length of input string */
  93. <     register BUFFER *listbuf;/* buffer to put completion list into */
  94. <     register char *fname;    /* trial file to complete */
  95. <     /* get a buffer for the completion list */
  96. <     listbuf = bfind("[Completion list]", TRUE, BFINVS);
  97. <     if (listbuf == NULL || bclear(listbuf) == FALSE) {
  98. <         ctrlg(FALSE, 0);
  99. <         TTflush();
  100. <         return;
  101. <     }
  102. <     /* first, we start at the first file and scan the list */
  103. <     name_len = *cpos;
  104. <     name[*cpos] = 0;
  105. <     fname = getffile(name);
  106. <     /* first, we start at the first file and scan the list */
  107. <     while (fname) {
  108. <         /* is this a match? */
  109. <         if (strncmp(name, fname, name_len) == 0)
  110. <             addline(listbuf, fname);
  111. <         /* on to the next file */
  112. <         fname = getnfile();
  113. <     }
  114. <     wpopup(listbuf);
  115.